fix: handle setting protected/type-enforced attributes correctly #433
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses a bug where you couldn't set the
nameattribute as private using theAttributesBuilder::SetPrivate(key, value)API.The issue was that this API forwards to an internal
AttributesBuilder::Set(key, value, is_private)method, which disallowed setting of "protected" attributes.In this PR, I've re-designated attributes as:
_meta,kind, andkey.anonymousandnameWithin (2), the current behavior is that both of these can be marked private, which isn't really correct. In reality only
namecan be redacted.So currently, you could say
SetPrivate("anonymous, true), and it'd set it and add it to the private attributes list. Come redaction time, it wouldn't be redacted.To make this totally consistent, we'd need to disallow
SetPrivate("anonymous", ..)as well as modify theAddPrivateAttributeandAddPrivateAttributesAPIs.Perhaps the behavior in this PR is sufficient, given some documentation that mentions that setting
anonymousprivate isn't meaningful.